package com.leyou.gateway.web;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 虎哥
 */
@RestController
@RequestMapping("hystrix")
public class HystrixFallbackController {

    @GetMapping("fallback")
    public ResponseEntity<String> handleFallback(){
        // 返回指定状态码：GATEWAY_TIMEOUT(504), 及响应体："请求超时了,请重试！"
        return ResponseEntity.status(HttpStatus.GATEWAY_TIMEOUT).body("请求超时了,请重试！");
    }
}
